<?php
	require_once("../conexion/conexion.php");
	function BuscaRenPendientes()
	{    
		$con = new Conexion();
		$con2 = $con->conexionBD("fpproduccion");
		$sql = "select RenId,RenPersona,RenObs,date_format(RenFecha,'%d/%m/%Y') as fecha,RenMonto from rendicion where RenEstado='PENDIENTE'";
		$res= mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
		$fila = mysql_num_rows($res);  
		$con->cerrarBD();  
		$array = array();    
		while($row = mysql_fetch_array($res))
		{        
			$array[] = $row;    
		}    
		return $array;
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
<link href="../Estilos/global.css" rel="stylesheet" type="text/css" />
<link href="../Estilos/local.css" rel="stylesheet" type="text/css" />
<link href="../Estilos/CssTabla3.css" rel="stylesheet" type="text/css" />

<script src="../include_js/jquery.js" type="text/javascript"></script>

<style>
.texto
{
	font-size:14px;
	margin-left:10px;
	font:Verdana, Arial, Helvetica, sans-serif; 
	color:#0066CC;
}
.borde
{
	/*border:0px solid #6593C0;*/
	border:1px solid #D3E4E5;
}
.asterisco
{
	color:#0000FF;
	font-weight:bold;
}
.radioBorde
{ 
 background:#D3E4E5;
 border:0px solid #89C0C7;
}
.filaPar
{
	background:#81D371; 
	font-family:Verdana, Arial, Helvetica, sans-serif; 
    font-size:11px;
	text-align:center;
	vertical-align:middle;
	padding:3px;
}
.filaImpar
{
	background:#AEF1A1;
	font-family:Verdana, Arial, Helvetica, sans-serif; 
    font-size:11px;
	text-align:center;
	vertical-align:middle;
	padding:3px;
}
.radioPar
{
	background:#81D371;
	border-color:#81D371;
}
.radioImpar
{
	background:#AEF1A1;
	border-color:#AEF1A1;
}
</style>
<script>
function CancelaListaRendicion()
{
	$.ajax({
            type: 'POST',
            url: 'Contabilidad/MenuRendicionCajaChica.php',
            data: $('#form_pendientes').serialize(),
            success: function(data) {
                $('#capa3').html(data);
            }
        })
}

function CargaDatos(valor)
{
	/*numero = document.getElementById("tablaRenPend").rows[valor].cells[0].innerText;
	persona = document.getElementById("tablaRenPend").rows[valor].cells[1].innerText;
	monto = document.getElementById("tablaRenPend").rows[valor].cells[4].innerText;
	//alert(numero+" "+persona);
	window.open("Contabilidad/ventana_Rendicion.php?var="+numero+"&persona="+persona+"&monto="+monto,"VentanaRendicion","width=741,height=400,scrollbars=yes");*/

	//window.location.replace("carga_rendiciones_pendientes.php");
	//location.reload();
	//alert(valor);
	$.ajax({
            type: 'POST',
            url: 'Contabilidad/ventana_Rendicion.php',
            data:{valor:valor},
            success: function(data) {
                $('#pagoRendicion').html(data);
            }
        })
}
</script>
</head>

<body>
<div id="pagoRendicion">
<form name="form_pendientes" id="form_pendientes" method="post">
<?php
		$row = BuscaRenPendientes();
		if(count($row)>0)
		{
?>

<div class='groupbox'>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="uno">
<tr><td class="borde"><div style="float:left; clear:none; margin-top:5px;"><label class="texto" style="font-weight:bold;">Rendiciones Pendientes.</label></div></td></tr>
<tr><td class="borde">&nbsp;</td></tr>
<tr><td class="borde">
<div align="center">
 <div class="cabecera">
	<table width="100%" border="0" cellpadding="0" cellspacing="0" class="fija" id="tablaRenPend">
	<thead class="fija">
	<tr class="fija">
		<th width="5%" class="fija">id</th>
		<th width="28%" class="fija">responsable</th>
		<th width="38%" class="fija">motivo</th>
		<th width="15%" class="fija">fecha</th>
		<th width="14%" class="fija">monto</th>
		<th width="2%" class="fija">&nbsp;</th>
	</tr>
	</thead>
      <tbody class="fija">
        <!-- <tr class="fija"><td colspan="6" class="fija">&nbsp;</td></tr>-->
	
	<?php
		$cont=1;
		for($i=0;$i<count($row);$i++)
		{
				if(($cont % 2)==0)
				{
					echo "<tr class=\"filaPar\">";
					echo "<td width=\"5%\" style='text-align:center;'>".$row[$i][0]."</td>";
					echo "<td width=\"28%\" style=\"vertical-align:middle;\">".$row[$i][1]."</td>";
					echo "<td width=\"38%\" style=\"vertical-align:middle;\">".$row[$i][2]."</td>";
					echo "<td width=\"15%\" style='text-align:center;'>".$row[$i][3]."</td>";
					echo "<td width=\"14%\" style='text-align:right;padding-right:20px;'>$".number_format ($row[$i][4],0,',','.')."</td>";
					echo "<td width=\"2%\"><input name=\"opcion\" class=\"radioPar\" type=\"radio\" value=\"$cont\" onclick=\"CargaDatos('".$row[$i][0]."');\" /></td>";
					echo "</tr>";
				}
				else
				{
					echo "<tr class=\"filaImpar\">";
					echo "<td width=\"5%\" style='text-align:center;'>".$row[$i][0]."</td>";
					echo "<td width=\"28%\" style=\"vertical-align:middle;\">".$row[$i][1]."</td>";
					echo "<td width=\"38%\" style=\"vertical-align:middle;\">".$row[$i][2]."</td>";
					echo "<td width=\"15%\" style='text-align:center;'>".$row[$i][3]."</td>";
					echo "<td width=\"14%\"style='text-align:right;padding-right:20px;'>$".number_format ($row[$i][4],0,',','.')."</td>";
					echo "<td width=\"2%\"><input name=\"opcion\" class=\"radioImpar\" type=\"radio\" value=\"$cont\" onclick=\"CargaDatos('".$row[$i][0]."');\" /></td>";
					echo "</tr>";
				}
			$cont++;
		}
			?>
			</tbody>
	</table>
</div>
</div>
</td>
</tr>
<tr><td class="borde">&nbsp;</td></tr>
<tr><td class="borde"><div class="formtail">
  <input type="button" name="btn_Cancelar_Lista_Rendicion" id="btn_Cancelar_Lista_Rendicion" value="Volver" onclick="CancelaListaRendicion();"/></div></td></tr>
<tr>
</tr>
</table>
</div>

<?php } ?>
</form>
</div>
</body>
</html>
